package org.example.stu;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.*;
import java.util.Properties;


import org.duckdb.*;

public class TestDuckDb {

    public static void main(String[] args) throws Exception  {
        Class.forName("org.duckdb.DuckDBDriver");
        Connection conn = DriverManager.getConnection("jdbc:duckdb:");

        // create a table
        Statement stmt = conn.createStatement();
//        stmt.execute("CREATE TABLE items (item VARCHAR, value DECIMAL(10, 2), count INTEGER)");
//        // insert two items into the table
//        stmt.execute("INSERT INTO items VALUES ('jeans', 20.0, 1), ('hammer', 42.2, 2)");
//
//        try (ResultSet rs = stmt.executeQuery("SELECT * FROM items")) {
//            while (rs.next()) {
//                System.out.println(rs.getString(1));
//                System.out.println(rs.getInt(3));
//            }
//        }
//        stmt.close();

//        String sql = CommonTools.readSqlFile("test.sql"); // 获取sql语句
        String sql = CommonTools.readSqlFile("sql/do_some.sql"); // 获取sql语句
//        ResultSet rs = stmt.executeQuery(sql);  // 执行查询
        stmt.execute(sql); // 只执行查询不返回结果
//        System.out.println("SKU" + "\t" + "cal" );
//        while (rs.next()) {
//            System.out.println(rs.getString(1) +
//                    "\t" + rs.getString(2) +
//                    "\t" + rs.getString(3)
//            );
//        }

    }
}
